#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
示例输出 - 展示当有.spe文件时的效果
"""

def generate_example_output():
    """生成示例输出"""
    print("SPE to TIF 宏代码生成器 - 示例输出")
    print("=" * 50)
    
    # 模拟找到的.spe文件
    spe_files = [
        "A/test.spe",
        "A/sample1.spe", 
        "A/experiment.spe"
    ]
    
    input_path = "A"
    output_path = "B"
    
    print(f"输入路径: {input_path}")
    print(f"输出路径: {output_path}")
    print(f"找到 {len(spe_files)} 个.spe文件")
    print()
    
    # 生成宏代码
    macro_code = []
    for spe_file in spe_files:
        filename = spe_file.split("/")[-1]  # 获取文件名
        name_without_ext = filename.replace(".spe", "")
        
        macro_code.append(f'open("{spe_file}");')
        macro_code.append(f'saveAs("Tiff", "{output_path}/{name_without_ext}.tif");')
        macro_code.append('close();')
        macro_code.append("")  # 空行分隔
    
    result = "\n".join(macro_code)
    
    print("生成的宏代码:")
    print("-" * 30)
    print(result)
    
    # 保存示例文件
    with open("example_macro.ijm", 'w', encoding='utf-8') as f:
        f.write(result)
    
    print(f"\n示例宏代码已保存到: example_macro.ijm")
    
    # 显示文件结构
    print("\n文件结构示例:")
    print("-" * 20)
    print("A/")
    print("  ├── test.spe")
    print("  ├── sample1.spe")
    print("  └── experiment.spe")
    print()
    print("B/ (输出文件夹)")
    print("  ├── test.tif")
    print("  ├── sample1.tif")
    print("  └── experiment.tif")

if __name__ == "__main__":
    generate_example_output() 